// 运算符重载 +
#include <iostream>
using namespace std;
class Box {
public:
    int m_volume;
    int m_price;
    Box();
    Box(int volume, int price);
    // 成员函数重载 +
    Box operator+(const Box &box) {
        Box temp(0, 0);
        temp.m_volume = this->m_volume + box.m_volume;
        temp.m_price = this->m_price + box.m_price;
        return temp;
    }
};
Box::Box() {}
Box::Box(int volume, int price) {
    this->m_volume = volume;
    this->m_price = price;
}
// 全局函数重载 +
Box operator+(const Box &b1, const Box &b2) {
    Box temp;
    temp.m_volume = b1.m_volume + b2.m_volume;
    temp.m_price = b1.m_price + b2.m_price;
    return temp;
}
void test1() {
    Box b1(10, 20), b2(20, 50);
    Box b3 = b1 + b2;
    cout << "b3.m_volume = " << b3.m_volume << endl;
    cout << "b3.m_price = " << b3.m_price << endl;

}
int main(void) {
    test1();

    return 0;
}